
import Main from '@/views/main/main.vue'
import IFrame from '@/components/iframe/iframe.vue'
import ParentView from '@/components/parent-view/parent-view.vue'

/**
 * meta除了原生参数外可配置的参数:
 * meta: {
 *  hideInMenu: (false) 设为true后在左侧菜单不会显示该页面选项
 *  notCache: (false) 设为true后页面不会缓存
 *  access: (null) 可访问该页面的权限数组，当前路由设置的权限会影响子路由
 *  icon: (-) 该页面在左侧菜单、面包屑和标签导航处显示的图标，如果是自定义图标，需要在图标名称前加下划线'_'
 * }
 */

const Login = {
    path: '/login',
    name: 'login',
    meta: {
        hideInMenu: true
    },
    component: () => import('@/views/login/login.vue')
}

const Home = {
    path: '/',
    name: '_home',
    redirect: '/home',
    component: Main,
    meta: {
        hideInMenu: true,
        icon: 'el-icon-location'
    },
    children: [
        {
            path: '/home',
            name: 'home',
            meta: {
                title: '首页',
                hideInMenu: true,
                icon: 'el-icon-location'
            },
            component: () => import('@/views/dashboard/dashboard.vue')
        }
    ]
}

const Errors = [
    {
        path: '/errors',
        component: Main,
        redirect: 'noredirect',
        name: 'ErrorPages',
        meta: {
            title: '错误',
            hideInMenu: true,
            icon: 'el-icon-location'
        },
        children: [
            {
                path: '401',
                component: () => import('@/views/errors/401.vue'),
                name: 'Page401',
                meta: {
                    title: '401',
                    hideInMenu: true,
                    icon: 'el-icon-location'
                }
            },
            {
                path: '404',
                component: () => import('@/views/errors/404.vue'),
                name: 'Page404',
                meta: {
                    title: '404',
                    hideInMenu: true,
                    icon: 'el-icon-location'
                }
            }
        ]
    },
    {
        path: '*',
        name: 'error_404',
        redirect: '/errors/404',
        meta: {
            hideInMenu: true
        }
    }
]

const Biz = [
    {
        path: '/demo1',
        name: 'demo1',
        component: Main,
        meta: {
            title: 'demo1',
            hideInMenu: false,
            icon: 'el-icon-location'
        },
        children: [
            {
                path: 'table-b',
                name: 'table-b',
                meta: {
                    title: '大表格',
                    icon: 'el-icon-location'
                },
                component: () => import('@/views/demo/table.vue')
            }
        ]
    },
    {
        path: '/components',
        name: 'components',
        component: Main,
        meta: {
            title: '组件',
            icon: 'el-icon-location'
        },
        children: [
            {
                path: 'tinymce',
                name: 'tinymce',
                meta: {
                    title: '富文本',
                    icon: 'el-icon-location'
                },
                component: () => import('@/views/demo/tinymce.vue')
            }
        ]
    },
    {
        path: '/iframe1',
        name: 'iframe1',
        component: Main,
        meta: {
            title: '外部链接',
            hideInMenu: false,
            icon: 'el-icon-location'
        },
        children: [
            {
                path: 'baidu',
                name: 'baidu',
                meta: {
                    title: '百度 IFrame',
                    icon: 'el-icon-location',
                    href: 'https://www.sass.hk/docs/'
                },
                component: IFrame
            }
        ]
    },
    {
        path: '',
        name: 'iframe2',
        meta: {
            title: '百度_Blank',
            icon: 'el-icon-location',
            href: 'http://www.baidu.com',
            target: '_blank'
        }
    },
    {
        path: '/demo2',
        name: 'demo2',
        meta: {
            title: '测试用例1',
            icon: 'el-icon-location'
        },
        component: Main,
        children: [
            {
                path: 'table1',
                name: 'table1',
                meta: {
                    title: '表格1',
                    icon: 'el-icon-location'
                },
                component: () => import('@/views/demo/demo.vue')
            },
            {
                path: 'table2',
                name: 'table2',
                meta: {
                    title: '表格2',
                    hideInMenu: true,
                    icon: 'el-icon-location'
                },
                component: () => import('@/views/demo/demo.vue')
            },
            {
                path: 'table3',
                name: 'table3',
                meta: {
                    title: '表格3',
                    icon: 'el-icon-location'
                },
                component: () => import('@/views/demo/demo.vue')
            },
            {
                path: '/table-sub',
                name: 'table-sub',
                meta: {
                    title: '子表格',
                    icon: 'el-icon-location'
                },
                component: ParentView,
                children: [
                    {
                        path: 'table1-1',
                        name: 'table1-1',
                        meta: {
                            title: '表格1-1',
                            icon: 'el-icon-location'
                        },
                        component: () => import('@/views/demo/demo.vue')
                    },
                    {
                        path: 'table1-2',
                        name: 'table1-2',
                        meta: {
                            title: '表格1-2',
                            hideInMenu: true,
                            icon: 'el-icon-location'
                        },
                        component: () => import('@/views/demo/demo.vue')
                    },
                    {
                        path: 'table1-33',
                        name: 'table1-33',
                        meta: {
                            title: '表格1-33',
                            icon: 'el-icon-location'
                        },
                        component: () => import('@/views/demo/demo.vue')
                    }
                ]
            }
        ]
    }
]

export default [
    Login,
    Home,
    ...Biz,
    ...Errors
]